<?php 
session_start();
	require 'db.php';

	$id=$_POST['id'];
	$ip=$_SERVER["REMOTE_ADDR"];
	$sql_i ="UPDATE oc_sport_ip SET total = total+1 WHERE ip='$ip'";
	$query=mysql_query($sql_i);
	$sql_j ="SELECT total FROM oc_sport_ip WHERE ip='$ip'";
	$query=mysql_query($sql_j);
	if($query&&mysql_num_rows($query)){
			while($row=mysql_fetch_assoc($query)){
				$totalj[]=$row;
		}
	}
	if($totalj[0]['total']>=2000){
		echo "点赞上限";
	}else{
		$sql_a ="UPDATE oc_sport_academy SET cheer = cheer+1 WHERE id='$id'";
		$query=mysql_query($sql_a);
		$sql ="SELECT * FROM oc_sport_academy WHERE id='$id'";
		$query=mysql_query($sql);
		if($query&&mysql_num_rows($query)){
				while($row=mysql_fetch_assoc($query)){
					$cheer[]=$row;
			}
		}
		echo $cheer[0]['cheer'];
	}
	
	mysql_close($link);

	

?>